﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using IAM.Interface.Model;
using System.ServiceModel.Channels;
using IAM.Interface.Common;

using System.Text;
using System.Net;
using System.IO;
using IAM.Interface.IDAL;
using IAM.Interface.DAL.Request;
using System.Xml;
using RequestLocalLibrary;
using IAM.Interface.Model.ENUM;
using System.ComponentModel;

public partial class Request : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    #region 创建请求
    protected void Button1_Click(object sender, EventArgs e)
    {
        Business business = new Business();

        AccountInfo ai = null;
        ACMMode acmmode = null;
        ACI aci = null;
        bool rd = false;
        Modules md = null;
        AIDelegations aid = null;
        switch (DropDownList1.SelectedValue)
        {
            case "创建用户身份":
                ai = business.CreateIdentity(CreateIdentity(), GetAppType());
                this.TextBox1.Text = ai.XML;
                break;
            case "激活用户身份":
                ai = business.EnableIdentity(EnableIdentity(), GetAppType());

                this.TextBox1.Text = ai.XML;
                break;
            case "禁用用户身份":
                ai = business.DisableIdentity(DisableIdentity(), GetAppType());
                this.TextBox1.Text = ai.XML;
                break;
            case "删除用户身份":
                ai = business.DeleteIdentity(DeleteIdentity(), GetAppType());
                this.TextBox1.Text = ai.XML;
                break;
            case "更新用户身份":
                ai = business.UpdateIdentity(UpdateIdentity(), GetAppType());
                this.TextBox1.Text = ai.XML;
                break;
            case "获取权限模型":
                acmmode = business.GetACIModel(GetAppType());
                this.TextBox1.Text = acmmode.XML;
                
                break;
            case "获取用户权限信息":
                aci = business.GetUserACI(GetUserACI(), GetAppType());
                this.TextBox1.Text = aci.XML;
                break;
            case "设置用户权限信息":
                aci = business.SetUserACI(SetUserACI(), GetAppType());
                this.TextBox1.Text = aci.XML;
                break;
            case "组织信息更新":
                rd = business.UpdateOrganize(UpdateOrganize(), GetAppType());
                this.TextBox1.Text = rd.ToString();
                break;
            case "组织机构创立":
                rd = business.CreateOrganize(CreateOrganize(), GetAppType());
                this.TextBox1.Text = rd.ToString();
                break;
            case "组织结构删除/合并":
                rd = business.DeleteOrganize(DeleteOrganize(), GetAppType());
                this.TextBox1.Text = rd.ToString();
                break;
            case "获取可代理模块列表":
                md = business.GetModuleList( GetAppType());
                this.TextBox1.Text = md.XML;
                break;
            case "获取用户代理信息":
                aid = business.GetDelegationInfo(GetDelegationInfo(), GetAppType());
                this.TextBox1.Text = aid.XML;
                break;
            case "设置用户代理信息":
                aid = business.SetDelegationInfo(SetDelegationInfo(), GetAppType());
                this.TextBox1.Text = aid.XML;
                break;

        }

    }
    #endregion
    #region 创建用户
    /// <summary>
    /// 创建用户
    /// </summary>
    /// <returns></returns>
    public Identity CreateIdentity()
    {
        Identity ir = new Identity();
        StringBuilder _xml = new StringBuilder();

        _xml.Append("<RequestData TransactionID=\"\" RequestTime=\"\" AppName=\"\" Token=\"\" ActionType=\"IDEN_MANAGE\" >");
        _xml.Append("<OperationType>Create</OperationType>");
        _xml.Append("<Identity>");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>123456</HRISEID>");
        _xml.Append("<ADAccount>ad4\\zhangshan</ADAccount>");
        _xml.Append("<CSLAccount>zhangshan</CSLAccount>");
        _xml.Append("<CILX500>Zhang Shan</CILX500>");
        _xml.Append("<UPI>CV-88888</UPI>");
        _xml.Append("<AppAccount>创建AppAccount</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("<Name>Zhang Shan</Name>");
        _xml.Append("<EName>Mike Zhang</EName>");
        _xml.Append("<FirstName>Mike</FirstName>");
        _xml.Append("<EMail>zhang.shan@alcatel-sbell.com.cn</EMail>");
        _xml.Append("<Telephone>56781234</Telephone>");
        _xml.Append("<Mobile>13912345678</Mobile>");
        _xml.Append("<CILAccount>CN=shan ZHANG,OU=CN,O=ALCATEL</CILAccount>");
        _xml.Append("<Company></Company>");
        _xml.Append("<Department></Department>");
        _xml.Append("<SubDepartment></SubDepartment>");
        _xml.Append("<CostCenter></CostCenter>");
        _xml.Append("<Location>SHJQ</Location>");
        _xml.Append("<ReportTo>");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>234567</HRISEID>");
        _xml.Append("<ADAccount>ad4\\lisi</ADAccount>");
        _xml.Append("<CSLAccount>lisi</CSLAccount>");
        _xml.Append("<CILX500>Li Si</CILX500>");
        _xml.Append("<UPI>CV-666666</UPI>");
        _xml.Append("<AppAccount>AppAccount</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("</ReportTo>");
        _xml.Append("</Identity>");
        _xml.Append("</RequestData>");

        System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
        xd.LoadXml(_xml.ToString());
        XmlNode xn = xd.SelectSingleNode("/RequestData/Identity");

        ir.CurrentXmlNode = xn;
        ir = (Identity)ir.ConvertToObject();
        return ir;
    }
    #endregion
    #region 激活用户
    /// <summary>
    /// 激活用户
    /// </summary>
    /// <returns></returns>
    public Identity EnableIdentity()
    {
        Identity ir = new Identity();
        StringBuilder _xml = new StringBuilder();

        _xml.Append("<RequestData TransactionID=\"\" RequestTime=\"\" AppName=\"\" Token=\"\" ActionType=\"IDEN_MANAGE\" >");
        _xml.Append("<OperationType>Enable</OperationType>");
        _xml.Append("<Identity>");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>123456</HRISEID>");
        _xml.Append("<ADAccount>ad4\\zhangshan</ADAccount>");
        _xml.Append("<CSLAccount>zhangshan</CSLAccount>");
        _xml.Append("<CILX500>Zhang Shan</CILX500>");
        _xml.Append("<UPI>CV-88888</UPI>");
        _xml.Append("<AppAccount>激活AppAccount</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("<Name>Zhang Shan</Name>");
        _xml.Append("<EName>Mike Zhang</EName>");
        _xml.Append("<FirstName>Mike</FirstName>");
        _xml.Append("<EMail>zhang.shan@alcatel-sbell.com.cn</EMail>");
        _xml.Append("<Telephone>56781234</Telephone>");
        _xml.Append("<Mobile>13912345678</Mobile>");
        _xml.Append("<CILAccount>CN=shan ZHANG,OU=CN,O=ALCATEL</CILAccount>");
        _xml.Append("<Company></Company>");
        _xml.Append("<Department></Department>");
        _xml.Append("<SubDepartment></SubDepartment>");
        _xml.Append("<CostCenter></CostCenter>");
        _xml.Append("<Location>SHJQ</Location>");
        _xml.Append("<ReportTo>");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>234567</HRISEID>");
        _xml.Append("<ADAccount>ad4\\lisi</ADAccount>");
        _xml.Append("<CSLAccount>lisi</CSLAccount>");
        _xml.Append("<CILX500>Li Si</CILX500>");
        _xml.Append("<UPI>CV-666666</UPI>");
        _xml.Append("<AppAccount>AppAccount</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("</ReportTo>");
        _xml.Append("</Identity>");
        _xml.Append("</RequestData>");

        System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
        xd.LoadXml(_xml.ToString());
        XmlNode xn = xd.SelectSingleNode("/RequestData/Identity");

        ir.CurrentXmlNode = xn;
        ir = (Identity)ir.ConvertToObject();
        return ir;
    }
    #endregion
    #region 禁用用户
    /// <summary>
    /// 禁用用户
    /// </summary>
    /// <returns></returns>
    public Identity DisableIdentity()
    {
        Identity ir = new Identity();
        StringBuilder _xml = new StringBuilder();

        _xml.Append("<RequestData TransactionID=\"\" RequestTime=\"\" AppName=\"\" Token=\"\" ActionType=\"IDEN_MANAGE\" >");
        _xml.Append("<OperationType>Disable</OperationType>");
        _xml.Append("<Identity>");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>123456</HRISEID>");
        _xml.Append("<ADAccount>ad4\\zhangshan</ADAccount>");
        _xml.Append("<CSLAccount>zhangshan</CSLAccount>");
        _xml.Append("<CILX500>Zhang Shan</CILX500>");
        _xml.Append("<UPI>CV-88888</UPI>");
        _xml.Append("<AppAccount>禁用AppAccount</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("<Name>Zhang Shan</Name>");
        _xml.Append("<EName>Mike Zhang</EName>");
        _xml.Append("<FirstName>Mike</FirstName>");
        _xml.Append("<EMail>zhang.shan@alcatel-sbell.com.cn</EMail>");
        _xml.Append("<Telephone>56781234</Telephone>");
        _xml.Append("<Mobile>13912345678</Mobile>");
        _xml.Append("<CILAccount>CN=shan ZHANG,OU=CN,O=ALCATEL</CILAccount>");
        _xml.Append("<Company></Company>");
        _xml.Append("<Department></Department>");
        _xml.Append("<SubDepartment></SubDepartment>");
        _xml.Append("<CostCenter></CostCenter>");
        _xml.Append("<Location>SHJQ</Location>");
        _xml.Append("<ReportTo>");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>234567</HRISEID>");
        _xml.Append("<ADAccount>ad4\\lisi</ADAccount>");
        _xml.Append("<CSLAccount>lisi</CSLAccount>");
        _xml.Append("<CILX500>Li Si</CILX500>");
        _xml.Append("<UPI>CV-666666</UPI>");
        _xml.Append("<AppAccount>AppAccount</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("</ReportTo>");
        _xml.Append("</Identity>");
        _xml.Append("</RequestData>");

        System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
        xd.LoadXml(_xml.ToString());
        XmlNode xn = xd.SelectSingleNode("/RequestData/Identity");

        ir.CurrentXmlNode = xn;
        ir = (Identity)ir.ConvertToObject();
        return ir;
    }
    #endregion
    #region 删除用户
    /// <summary>
    /// 删除用户
    /// </summary>
    /// <returns></returns>
    public Identity DeleteIdentity()
    {
        Identity ir = new Identity();
        StringBuilder _xml = new StringBuilder();

        _xml.Append("<RequestData TransactionID=\"\" RequestTime=\"\" AppName=\"\" Token=\"\" ActionType=\"IDEN_MANAGE\" >");
        _xml.Append("<OperationType>Delete</OperationType>");
        _xml.Append("<Identity>");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>123456</HRISEID>");
        _xml.Append("<ADAccount>ad4\\zhangshan</ADAccount>");
        _xml.Append("<CSLAccount>zhangshan</CSLAccount>");
        _xml.Append("<CILX500>Zhang Shan</CILX500>");
        _xml.Append("<UPI>CV-88888</UPI>");
        _xml.Append("<AppAccount>删除AppAccount</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("<Name>Zhang Shan</Name>");
        _xml.Append("<EName>Mike Zhang</EName>");
        _xml.Append("<FirstName>Mike</FirstName>");
        _xml.Append("<EMail>zhang.shan@alcatel-sbell.com.cn</EMail>");
        _xml.Append("<Telephone>56781234</Telephone>");
        _xml.Append("<Mobile>13912345678</Mobile>");
        _xml.Append("<CILAccount>CN=shan ZHANG,OU=CN,O=ALCATEL</CILAccount>");
        _xml.Append("<Company></Company>");
        _xml.Append("<Department></Department>");
        _xml.Append("<SubDepartment></SubDepartment>");
        _xml.Append("<CostCenter></CostCenter>");
        _xml.Append("<Location>SHJQ</Location>");
        _xml.Append("<ReportTo>");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>234567</HRISEID>");
        _xml.Append("<ADAccount>ad4\\lisi</ADAccount>");
        _xml.Append("<CSLAccount>lisi</CSLAccount>");
        _xml.Append("<CILX500>Li Si</CILX500>");
        _xml.Append("<UPI>CV-666666</UPI>");
        _xml.Append("<AppAccount>AppAccount</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("</ReportTo>");
        _xml.Append("</Identity>");
        _xml.Append("</RequestData>");

        System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
        xd.LoadXml(_xml.ToString());
        XmlNode xn = xd.SelectSingleNode("/RequestData/Identity");

        ir.CurrentXmlNode = xn;
        ir = (Identity)ir.ConvertToObject();
        return ir;
    }
    #endregion
    #region 更新用户信息
    /// <summary>
    /// 更新用户信息
    /// </summary>
    /// <returns></returns>
    public Identity UpdateIdentity()
    {
        Identity ir = new Identity();
        StringBuilder _xml = new StringBuilder();

        _xml.Append("<RequestData TransactionID=\"\" RequestTime=\"\" AppName=\"\" Token=\"\" ActionType=\"IDEN_MANAGE\" >");
        _xml.Append("<OperationType>Update</OperationType>");
        _xml.Append("<Identity>");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>123456</HRISEID>");
        _xml.Append("<ADAccount>ad4\\zhangshan</ADAccount>");
        _xml.Append("<CSLAccount>zhangshan</CSLAccount>");
        _xml.Append("<CILX500>Zhang Shan</CILX500>");
        _xml.Append("<UPI>CV-88888</UPI>");
        _xml.Append("<AppAccount>更新AppAccount</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("<Name>Zhang Shan</Name>");
        _xml.Append("<EName>Mike Zhang</EName>");
        _xml.Append("<FirstName>Mike</FirstName>");
        _xml.Append("<EMail>zhang.shan@alcatel-sbell.com.cn</EMail>");
        _xml.Append("<Telephone>56781234</Telephone>");
        _xml.Append("<Mobile>13912345678</Mobile>");
        _xml.Append("<CILAccount>CN=shan ZHANG,OU=CN,O=ALCATEL</CILAccount>");
        _xml.Append("<Company></Company>");
        _xml.Append("<Department></Department>");
        _xml.Append("<SubDepartment></SubDepartment>");
        _xml.Append("<CostCenter></CostCenter>");
        _xml.Append("<Location>SHJQ</Location>");
        _xml.Append("<ReportTo>");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>234567</HRISEID>");
        _xml.Append("<ADAccount>ad4\\lisi</ADAccount>");
        _xml.Append("<CSLAccount>lisi</CSLAccount>");
        _xml.Append("<CILX500>Li Si</CILX500>");
        _xml.Append("<UPI>CV-666666</UPI>");
        _xml.Append("<AppAccount>AppAccount</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("</ReportTo>");
        _xml.Append("</Identity>");
        _xml.Append("</RequestData>");

        System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
        xd.LoadXml(_xml.ToString());
        XmlNode xn = xd.SelectSingleNode("/RequestData/Identity");

        ir.CurrentXmlNode = xn;
        ir = (Identity)ir.ConvertToObject();
        return ir;
    }
    #endregion
    #region 获取权限模型
    /// <summary>
    /// 获取权限模型
    /// </summary>
    /// <returns></returns>
    public NullityObj GetACIModel()
    {
        return new NullityObj();
    }
    #endregion
    #region 设置用户权限信息
    /// <summary>
    /// 设置用户权限信息
    /// </summary>
    /// <returns></returns>
    public ACI SetUserACI()
    {
        StringBuilder _xml = new StringBuilder();


        _xml.Append("<ResponseData TransactionID=\"\" ResponseTime=\"\" StatusCode=\"\" ReturnMessage=\"\" >");
        _xml.Append("<Result ErrorCode=\"0\" ErrorMessage=\"OK\" />");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>123456</HRISEID>");
        _xml.Append("<ADAccount>ad4\\zhangshan</ADAccount>");
        _xml.Append("<CSLAccount>zhangshan</CSLAccount>");
        _xml.Append("<CILX500>Zhang Shan</CILX500>");
        _xml.Append("<UPI>CV-88888</UPI>");
        _xml.Append("<AppAccount>设置用户权限信息</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("<ACISessions Count=\"2\">");
        _xml.Append("<ACISession>");
        _xml.Append("<CheckedItem ACItemID=\"Project Manager\" Value=\"check\" />");
        _xml.Append("<CheckedItem ACItemID=\"G007\" Value=\"check\" />");
        _xml.Append("</ACISession>");
        _xml.Append("<ACISession>");
        _xml.Append("<CheckedItem ACItemID=\"Department Manager\" Value=\"check\" />");
        _xml.Append("<CheckedItem ACItemID=\"D010\" Value=\"check\" />");
        _xml.Append("</ACISession>");
        _xml.Append("</ACISessions>");
        _xml.Append("</ResponseData>");

        XmlDocument sd = new XmlDocument();
        sd.LoadXml(_xml.ToString());
        XmlElement xe = sd.DocumentElement;

        ACI obj = new ACI();
        obj.CurrentXmlNode = (XmlNode)xe;
        obj = (ACI)obj.ConvertToObject();
        return obj;
    }
    #endregion
    #region 获取用户权限信息
    /// <summary>
    /// 获取用户权限信息
    /// </summary>
    /// <returns></returns>
    public AccountInfo GetUserACI()
    {
        StringBuilder _xml = new StringBuilder();

        _xml.Append("<RequestData TransactionID=\"\" RequestTime=\"\" AppName=\"\" Token=\"\" ActionType=\"IDEN_GETUSERACI\" >");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>123456</HRISEID>");
        _xml.Append("<ADAccount>gdc\\alan.huang</ADAccount>");
        _xml.Append("<CSLAccount>zhangshan</CSLAccount>");
        _xml.Append("<CILX500>Zhang Shan</CILX500>");
        _xml.Append("<UPI>CV-88888</UPI>");
        _xml.Append("<AppAccount>获取用户权限信息</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("</RequestData>");

        XmlDocument sd = new XmlDocument();
        sd.LoadXml(_xml.ToString());
        XmlElement xe = sd.DocumentElement;

        AccountInfo obj = new AccountInfo();
        obj.CurrentXmlNode = xe.SelectSingleNode("AccountInfo");
        obj = (AccountInfo)obj.ConvertToObject();
        return obj;
    }
    #endregion
    #region 获取可代理模块列表
    /// <summary>
    /// 获取可代理模块列表
    /// </summary>
    /// <returns></returns>
    public NullityObj GetModuleList()
    {
        return new NullityObj();
    }
    #endregion
    #region 获取用户代理信息
    /// <summary>
    /// 获取用户代理信息
    /// </summary>
    /// <returns></returns>
    public AccountInfo GetDelegationInfo()
    {
        StringBuilder _xml = new StringBuilder();

        _xml.Append("<RequestData TransactionID=\"\" RequestTime=\"\" AppName=\"\" Token=\"\" ActionType=\"IDEN_GETUSERACI\" >");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>123456</HRISEID>");
        _xml.Append("<ADAccount>ad4\\zhangshan</ADAccount>");
        _xml.Append("<CSLAccount>zhangshan</CSLAccount>");
        _xml.Append("<CILX500>Zhang Shan</CILX500>");
        _xml.Append("<UPI>CV-88888</UPI>");
        _xml.Append("<AppAccount>获取用户代理信息AppAccount</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("</RequestData>");

        XmlDocument sd = new XmlDocument();
        sd.LoadXml(_xml.ToString());
        XmlElement xe = sd.DocumentElement;

        AccountInfo obj = new AccountInfo();
        obj.CurrentXmlNode = xe.SelectSingleNode("AccountInfo");
        obj = (AccountInfo)obj.ConvertToObject();
        return obj;
    }
    #endregion
    #region 设置用户代理信息
    /// <summary>
    /// 设置用户代理信息
    /// </summary>
    /// <returns></returns>
    public AIDelegations SetDelegationInfo()
    {
        StringBuilder _xml = new StringBuilder();


        _xml.Append("<RequestData TransactionID=\"\" RequestTime=\"\" AppName=\"\" Token=\"\" ActionType=\"DM_SETDELEINFO\" >");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>123456</HRISEID>");
        _xml.Append("<ADAccount>ad4\\zhangshan</ADAccount>");
        _xml.Append("<CSLAccount>zhangshan</CSLAccount>");
        _xml.Append("<CILX500>Zhang Shan</CILX500>");
        _xml.Append("<UPI>CV-88888</UPI>");
        _xml.Append("<AppAccount>设置用户代理信息AppAccount</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("<Delegations Count=\"2\">");
        _xml.Append("<Delegation Module=\"Module1\" Type=\"OperateAs\" BeginDate=\"2008-12-01\" EndDate=\"2008-12-31\">");
        _xml.Append("<Delegator>");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>234567</HRISEID>");
        _xml.Append("<ADAccount>ad4\\lisi</ADAccount>");
        _xml.Append("<CSLAccount>lisi</CSLAccount>");
        _xml.Append("<CILX500>Li Si</CILX500>");
        _xml.Append("<UPI>CV-88889</UPI>");
        _xml.Append("<AppAccount>Li Si Account</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("</Delegator>");
        _xml.Append("</Delegation>");
        _xml.Append("<Delegation Module=\"Module2\" Type=\"Delegate\" BeginDate=\"2008-12-01\" EndDate=\"2008-12-31\">");
        _xml.Append("<Delegator>");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>234567</HRISEID>");
        _xml.Append("<ADAccount>ad4\\lisi</ADAccount>");
        _xml.Append("<CSLAccount>lisi</CSLAccount>");
        _xml.Append("<CILX500>Li Si</CILX500>");
        _xml.Append("<UPI>CV-88889</UPI>");
        _xml.Append("<AppAccount>Li Si Account</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("</Delegator>");
        _xml.Append("</Delegation>");
        _xml.Append("</Delegations>");
        _xml.Append("</RequestData>");


        XmlDocument sd = new XmlDocument();
        sd.LoadXml(_xml.ToString());
        XmlElement xe = sd.DocumentElement;

        AIDelegations obj = new AIDelegations();
        obj.CurrentXmlNode = (XmlNode)xe;
        obj = (AIDelegations)obj.ConvertToObject();
        return obj;
    }
    #endregion
    #region 组织信息更新
    /// <summary>
    /// 组织信息更新
    /// </summary>
    /// <returns></returns>
    public OrganizeInfo UpdateOrganize()
    {
        StringBuilder _xml = new StringBuilder();


        _xml.Append("<RequestData TransactionID=\"\" RequestTime=\"\" AppName=\"\" Token=\"\" ActionType=\"ORG_UPDAGE\" >");
        _xml.Append("<OrgID>D010</OrgID>");
        _xml.Append("<OrgType>BD</OrgType>");
        _xml.Append("<OrgAPBR>BTJ</OrgAPBR>");
        _xml.Append("<OrgName>Branch(Tianjin)</OrgName>");
        _xml.Append("<OrgCName>分公司(天津)</OrgCName>");
        _xml.Append("<AdminID>G007</AdminID>");
        _xml.Append("<Director>");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>123456</HRISEID>");
        _xml.Append("<ADAccount>ad4\\zhangshan</ADAccount>");
        _xml.Append("<CSLAccount>zhangshan</CSLAccount>");
        _xml.Append("<CILX500>Zhang Shan</CILX500>");
        _xml.Append("<UPI>CV-88888</UPI>");
        _xml.Append("<AppAccount>AppAccount</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("</Director>");
        _xml.Append("</RequestData>");


        XmlDocument sd = new XmlDocument();
        sd.LoadXml(_xml.ToString());
        XmlElement xe = sd.DocumentElement;

        OrganizeInfo obj = new OrganizeInfo();
        obj.CurrentXmlNode = (XmlNode)xe;
        obj = (OrganizeInfo)obj.ConvertToObject();
        return obj;
    }
    #endregion
    #region 组织机构创立
    /// <summary>
    /// 组织机构创立
    /// </summary>
    /// <returns></returns>
    public OrganizeInfo CreateOrganize()
    {
        StringBuilder _xml = new StringBuilder();


        _xml.Append("<RequestData TransactionID=\"\" RequestTime=\"\" AppName=\"\" Token=\"\" ActionType=\"ORG_CREATE\" >");
        _xml.Append("<OrgID>D010</OrgID>");
        _xml.Append("<OrgType>BD</OrgType>");
        _xml.Append("<OrgAPBR>BTJ</OrgAPBR>");
        _xml.Append("<OrgName>Branch(Tianjin)</OrgName>");
        _xml.Append("<OrgCName>分公司(天津)</OrgCName>");
        _xml.Append("<AdminID>G007</AdminID>");
        _xml.Append("<Director>");
        _xml.Append("<AccountInfo>");
        _xml.Append("<HRISEID>123456</HRISEID>");
        _xml.Append("<ADAccount>ad4\\zhangshan</ADAccount>");
        _xml.Append("<CSLAccount>zhangshan</CSLAccount>");
        _xml.Append("<CILX500>Zhang Shan</CILX500>");
        _xml.Append("<UPI>CV-88888</UPI>");
        _xml.Append("<AppAccount>AppAccount</AppAccount>");
        _xml.Append("</AccountInfo>");
        _xml.Append("</Director>");
        _xml.Append("</RequestData>");


        XmlDocument sd = new XmlDocument();
        sd.LoadXml(_xml.ToString());
        XmlElement xe = sd.DocumentElement;

        OrganizeInfo obj = new OrganizeInfo();
        obj.CurrentXmlNode = (XmlNode)xe;
        obj = (OrganizeInfo)obj.ConvertToObject();
        return obj;
    }
    #endregion
    #region 组织结构删除（包括合并）
    /// <summary>
    /// 组织结构删除（包括合并）
    /// </summary>
    /// <returns></returns>
    public OrganizeDeleteParameter DeleteOrganize()
    {
        StringBuilder _xml = new StringBuilder();


        _xml.Append("<RequestData TransactionID=\"\" RequestTime=\"\" AppName=\"\" ActionType=\"ORG_DELETE\" >");
        _xml.Append("<OrgID>D010</OrgID>");
        _xml.Append("<MergeOrgID>D011</MergeOrgID>");
        _xml.Append("</RequestData>");

        XmlDocument sd = new XmlDocument();
        sd.LoadXml(_xml.ToString());
        XmlElement xe = sd.DocumentElement;

        OrganizeDeleteParameter obj = new OrganizeDeleteParameter();
        obj.CurrentXmlNode = (XmlNode)xe;
        obj = (OrganizeDeleteParameter)obj.ConvertToObject();
        return obj;
    }
    #endregion

    #region 发送地址
    private AppType GetAppType()
    {
        AppType apptype = AppType.Nullity;
        System.ComponentModel.EnumConverter enu = new EnumConverter(apptype.GetType());
        apptype = (AppType)enu.ConvertFrom(DropDownList2.SelectedValue);
        return apptype;
    }
    #endregion
}
